<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <style>
        textarea {
            width: 300px;
            height: 300px;
        }
    </style>
</head>
<body>
<h3>发送指令</h3>
<textarea id="json">{
  "key": "web",
  "open": "1"
}</textarea>
<br>
<button onclick="set()">发送指令</button>
<h3>配置信息</h3>
<textarea style="width: 600px;height: 600px;" id="config">{}</textarea>
<br>
<button onclick="config()">设置</button>
</body>
<script>
    window.test = () => {
        axios.post(
            '/api/order/set',
            JSON.parse(document.getElementById('json').value)
        )
    }
    window.config = () => {
        axios.post(
            '/api/order/config',
            JSON.parse(document.getElementById('config').value)
        )
    }
    setTimeout(() => {
        axios.get('/api/order/config')
            .then((res) => {
                const data = res.data;
                document.getElementById('config').value = JSON.stringify(data, null, 4)
            })
    })
</script>
</html>
